import scrapy

from yggk.items import UniversityItem
import csv
from concurrent import futures
import requests
import pandas as pd
import time
import tqdm
import random


class UniversitySpiderSpider(scrapy.Spider):
    name = 'university_spider'
    allowed_domains = ['gaokao.chsi.com.cn']
    start_urls = ['https://gaokao.chsi.com.cn/sch/search--ss-on,option-qg,searchType-1,start-0.dhtml']
    base_url = 'https://gaokao.chsi.com.cn'
    page = 1



    def parse_second(self, response):
        pass
        # address = response.xpath(
        #     '//body/div[1]/div[2]/div[1]/div[2]/div[3]/div[1]/span[2]/text()').extract_first()  # 详细地址
        # offweb = response.xpath('//body/div[1]/div[2]/div[1]/div[2]/div[3]/div[2]/a[1]/@href').extract_first()  # 官方网址
        # recweb = response.xpath('//body/div[1]/div[2]/div[1]/div[2]/div[3]/div[2]/a[2]/@href').extract_first()  # 招生网址
        # phone = response.xpath('//body/div[1]/div[2]/div[1]/div[2]/div[3]/div[3]/span/text()').extract_first()  # 官方电话
        # img = response.xpath('//body/div[1]/div[2]/div[1]/div[1]/img/@src').extract_first()  # 图片
        # yield UniversityItem(
        #     name=response.meta['name'],  # 院校名称
        #     city=response.meta['city'],  # 院校所在地
        #     department=response.meta['department'],  # 教育行政主管部门
        #     level=response.meta['level'],  # 学历层次
        #     first_rate=response.meta['first_rate'],  # “双一流”建设高校
        #     graduate=response.meta['graduate'],  # 研究生院
        #     satisfaction=response.meta['satisfaction'],  # 满意度
        #     address=address,  # 详细地址
        #     offweb=offweb,  # 官方网址
        #     recweb=recweb,  # 招生网址
        #     phone=phone,  # 官方电话
        #     img=img  # 图片
        # )
